package mytool;

import java.util.List;

/**
 * Created by zerdoor_pc on 2016/3/30.
 */
public class ListTools {
    public static List<Itude> check(List<Itude> MyItude, int length) {
        if (MyItude.size() >= length) {
            MyItude.remove(0);
            check(MyItude, length);
        }
        return MyItude;
    }
    public static List<Double> check(List<Double> MyItude, int length,int s) {
        if (MyItude.size() >= length) {
            MyItude.remove(0);
            check(MyItude, length,s);
        }
        return MyItude;
    }

    public static Itude getItude(List<Itude> MyItude) {
        double latitude = 0;
        double longitude = 0;
        for (Itude itude : MyItude) {
            latitude += itude.getLatitude();
            longitude += itude.getLongitude();
        }
        Itude itude = new Itude();
        itude.setLatitude(latitude / MyItude.size());
        itude.setLongitude(longitude / MyItude.size());
        return itude;
    }
    public static Double getItude_Double(List<Double> MyItude) {
        double S = 0;

        for (Double itude : MyItude) {
            S += itude;

        }
        S/=MyItude.size();
        return S;
    }
}
